//
//  IDCardCertificationCell.m
//  OnionHome
//
//  Created by fengjie on 2019/10/2.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "IDCardCertificationCell.h"


@interface IDCardCertificationCell ()
/**<#属性#>*/
@property (nonatomic,strong)UILabel*leftLabel;
/**<#属性#>*/
@property (nonatomic,strong)UILabel*rightLabel;
/**<#属性#>*/
@property (nonatomic,strong)UIButton*button;
@end


@implementation IDCardCertificationCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self createUI];
    }
    return self;
}
-(void)createUI{
    [self addSubview:self.leftLabel];
    [self addSubview:self.rightLabel];
    [self addSubview:self.button];
    
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.top.mas_equalTo(20);
        make.bottom.mas_equalTo(-20);
    }];
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16);
        make.top.mas_equalTo(20);
        make.bottom.mas_equalTo(-20);
    }];
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16);
        make.top.mas_equalTo(20);
        make.bottom.mas_equalTo(-20);
    }];
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(84);
        make.height.mas_equalTo(24);
    }];
}
-(void)setDic:(NSDictionary *)dic{
    _dic = dic;
    self.leftLabel.text = dic[@"leftName"];
    self.rightLabel.hidden = ![dic[@"rightName"] boolValue];
    self.button.hidden = [dic[@"rightName"] boolValue];
}
-(void)setOnionDic:(NSDictionary *)onionDic{
    _onionDic = onionDic;
    self.leftLabel.text = onionDic[@"leftName"];
    self.rightLabel.hidden = NO;
    self.button.hidden = YES;
    self.rightLabel.textColor = UIColorFromRGB(0x273323);
    self.rightLabel.font = SYSTEMFONT(14);
    self.rightLabel.text = onionDic[@"rightName"];
}
-(UILabel*)leftLabel{
    if(!_leftLabel){
        _leftLabel=[UILabel new];
        _leftLabel.textColor = UIColorFromRGB(0x273323);
        _leftLabel.font = SYSTEMFONT(18);
    }
    return _leftLabel;
}

-(UILabel*)rightLabel{
    if(!_rightLabel){
        _rightLabel=[UILabel new];
        _rightLabel.textColor = UIColorFromRGB(0x959E97);
        _rightLabel.font = SYSTEMFONT(16);
        _rightLabel.text = @"已完成";
    }
    return _rightLabel;
}
-(UIButton*)button{
    if(!_button){
        _button=[UIButton new];
        [_button setTitle:@"去完成" forState:UIControlStateNormal];
        [_button setTitleColor:KWhiteColor forState:UIControlStateNormal];
        [_button setBackgroundImage:IMAGE_NAMED(@"guanzhu_bg") forState:UIControlStateNormal];
        _button.titleLabel.font = SYSTEMFONT(14);

    }
    return _button;
}
@end
